package org.zhangxiao.paladin2.admin.cfg;

import org.zhangxiao.paladin2.admin.entity.SysCfg;
import com.baomidou.mybatisplus.extension.service.IService;
import org.zhangxiao.paladin2.common.exception.BizException;
import org.zhangxiao.paladin2.common.pojo.ICfg;

/**
 * <p>
 * 系统配置  服务类
 * </p>
 *
 * @author 听风zx
 * @since 2019-05-25
 */
public interface ISysCfgService extends IService<SysCfg> {

    String CFG_KEY_PREFIX = "sys-cfg:";

    <T extends ICfg> T getCfg(Class<T> cfgClass);

    <T extends ICfg> T getCfg(Class<T> cfgClass, String subKey);

    <T extends ICfg> void saveCfg(T cfg) throws BizException;

    <T extends ICfg> void saveCfg(T cfg, String subKey) throws BizException;

    <T extends ICfg> void deleteCfg(Class<T> cfgClass);

    <T extends ICfg> void deleteCfg(Class<T> cfgClass, String subKey);

    <T extends ICfg> void flushCfg(Class<T> cfgClass);

    <T extends ICfg> void flushCfg(Class<T> cfgClass, String subKey);

    void flushAll();

}
